package putao.ui
{
	import flash.text.TextFieldAutoSize;
	
	import putao.ui.assets.Assets;

	public class PRadioButton extends PSelectButton
	{
		private var _radioButtonGroup:PRadioButtonGroup;
		
		/**
		 * 单选按钮在radioButtonGroup中的id
		 * -1表示单选按钮并未加到radioButtonGroup中
		 */		
		public var id:int = -1;
		
		public function PRadioButton(text:String="")
		{
			super(text);
			
			txtLabel.x = 20;
			txtLabel.y = -4;
			txtLabel.autoSize = TextFieldAutoSize.LEFT;
		}
		
		override public function resize(width:Number, height:Number):void
		{
//			super.setSize(width, height);
		}
		
		
		public function get radioButtonGroup():PRadioButtonGroup
		{
			return _radioButtonGroup;
		}

		public function set radioButtonGroup(value:PRadioButtonGroup):void
		{
			_radioButtonGroup = value;
			value.addRadioButton(this);
		}

		override protected function initDefaultSkin():void
		{
			sBtnDafult = Assets.getDisplayObject(Assets.RadioDefault);
			sBtnRollover = Assets.getDisplayObject(Assets.RadioRollover);
			sBtnPressed = Assets.getDisplayObject(Assets.RadioPressed);
			sBtnDisabled = Assets.getDisplayObject(Assets.RadioDisabled);
			sSelectedBtnDafult = Assets.getDisplayObject(Assets.RadioSelDefault);
			sSelectedBtnRollover = Assets.getDisplayObject(Assets.RadioSelRollover);
			sSelectedBtnPressed = Assets.getDisplayObject(Assets.RadioSelPressed);
			sSelectedBtnDisabled = Assets.getDisplayObject(Assets.RadioSelDisabled);
		}
	}
}